import java.util.Scanner;
import java.util.ArrayList;
public class demo8_student{
    public static void main (String[] args){
    ArrayList<Student1> student =new ArrayList<Student1>();
    set(student);
    set(student);
    set(student);
    show(student);
    
    
    
    }
    public static void set(ArrayList<Student1> student){
    Scanner x = new Scanner(System.in);
    System.out.println("输入名字");
    String name = x.nextLine();
    System.out.println("输入年龄");
    int age =x.nextInt();
    Student1 xs = new Student1();
    xs.setName(name);
    xs.setAge(age);
    student.add(xs);
    
    }
    public static void show(ArrayList<Student1> student){
    for(int i=0;i<student.size();i++){
    Student1 s1 = student.get(i);
    System.out.println("姓名："+s1.getName());
    System.out.println("年龄："+s1.getAge());
    }
    
      
   
    }
   
}